package javase.collections;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class CopyTest {
	private static int counter = 0;
	
	public static void main(String[] args) {
		List<Integer> source = new ArrayList<Integer>();
		List<Integer> destination = new ArrayList<Integer>();
		intitList(source, 7);
		System.out.println("Source:" + source);
		intitList(destination, 3);
		System.out.println("Destination: " + destination);
		Collections.copy(destination, source);
		System.out.println("Destination: " + destination);
	}
	
	private static void intitList(List<Integer> list, int capacity) {
		for (int i = 0; i < capacity; i++) {
			list.add(counter++);
		}
		Collections.shuffle(list);
	}
}
